from django.shortcuts import render

# Create your views here.

# from rest_framework import mixins
# from rest_framework import generics
from rest_framework import viewsets

from stock.models import Stock
from stock.serializers import StockSerialzier
from stock.permissions import IsAdminUserOrReadOnly


class StockViewSet(viewsets.ModelViewSet):
    permission_classes = [IsAdminUserOrReadOnly]
    queryset = Stock.objects.all()
    serializer_class = StockSerialzier

    def perform_create(self, serializer):
        serializer.save()
